import WebGL = Laya.WebGL;
import Stage = Laya.Stage;
import Sprite = Laya.Sprite;
import Dictionary = Laya.Dictionary
import Scene = Laya.Scene;
import Camera = Laya.Camera;
import Sprite3D = Laya.Sprite3D;
import Vector3 = Laya.Vector3;
import Stat = Laya.Stat;
// 程序入口
class GameMain{
    private _camera:Camera;
	private _pos:Vector3 = new Vector3(310, 500, 0);
	private _translate:Vector3 = new Vector3(0, 0, 0);
	private _layaMonkey:Sprite3D
    constructor()
    {
        this.init3D();
    }

    /**
     * 初始化3D
     */
    private init3D():void
    {
        Laya3D.init(GameConfig.deviceW, GameConfig.deviceH,true);
        Laya.stage.scaleMode = Stage.SCALE_FULL;
        // Laya.stage.screenMode = Stage.SCREEN_NONE;
        Stat.show();
        
        SceneManager.instance.init()
        SceneManager.instance.addLayer(MapLayer);
        SceneManager.instance.addLayer(EffectLayer);
        SceneManager.instance.addLayer(ActorLayer);

        SceneManager.instance.addToLayer(WorldMap.instance.container,LayerType.MapLayer,0,0)
        SceneManager.instance.addToLayer(SelfPlayer.instance.disObj,LayerType.ActorLayer,1024,1024);
        InputManager.instance.init();
        SceneManager.instance.camera2D.focus(SelfPlayer.instance.disObj);
        Laya.timer.frameLoop(1,this,this.update);
    }   

    /**
     * 游戏更新
     */
    private update():void
    {
        SceneManager.instance.update();
        SelfPlayer.instance.update();
    }
}
new GameMain();